﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="CreateTableControlScript.aspx.cs" Inherits="CreateTableControlScript" %>

<%@ Register src="UserControl/Tables.ascx" tagname="Tables" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <div class="box">
        <h2>
           依Table欄位產生控制項</h2>
    </div>

EX.
<asp:Label ID="Label4" runat="server" Text="Title"></asp:Label>
<asp:TextBox ID="TextBox5" runat="server" ReadOnly="True">Control</asp:TextBox>
，請輸入控制項ID格式<br />
Title：&nbsp;&nbsp;&nbsp;&nbsp; 
<asp:TextBox ID="uxTitleIDFormate" runat="server" Width="135px">txt{0}</asp:TextBox>
<br />
Control：<asp:TextBox ID="uxControlIDFormate" runat="server" Width="135px">ux{0}</asp:TextBox>
<br />
請選擇Table
<uc1:Tables ID="Tables1" runat="server" />
<asp:Button ID="Button3" runat="server" AccessKey="s" Text="查詢欄位 (s)" 
        onclick="Button3_Click" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:MasertDB %>" 
    SelectCommand="SELECT  *  FROM INFORMATION_SCHEMA.COLUMNS a WHERE table_name=@table_name ">
    <SelectParameters>
        <asp:Parameter Name="table_name" />
    </SelectParameters>
</asp:SqlDataSource>
<asp:Button ID="Button2" runat="server" AccessKey="c" onclick="Button2_Click" 
    Text="產生 (c)" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    DataSourceID="SqlDataSource1">
    <Columns>
        <asp:BoundField DataField="COLUMN_NAME" HeaderText="欄位名稱" />
        <asp:BoundField HeaderText="欄位說明" />
        <asp:TemplateField HeaderText="功能">
            <ItemTemplate>
                <asp:CheckBoxList ID="uxCreateItem" runat="server" RepeatDirection="Horizontal">
                    <asp:ListItem Selected="True" Value="0">Title</asp:ListItem>
                    <asp:ListItem Selected="True" Value="1">Contril</asp:ListItem>
                </asp:CheckBoxList>
                <br />
                Control：<asp:RadioButtonList ID="uxCreateControlType" runat="server" 
                    RepeatDirection="Horizontal">
                    <asp:ListItem Selected="True">TextBox</asp:ListItem>
                    <asp:ListItem>Radio</asp:ListItem>
                    <asp:ListItem>Check</asp:ListItem>
                    <asp:ListItem>DropDownList</asp:ListItem>
                </asp:RadioButtonList>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
<asp:TextBox ID="uxResult" runat="server" Height="200px" TextMode="MultiLine" 
    Width="550px"></asp:TextBox>

<br />
<br />
<br />
<br />
</asp:Content>

